<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book Python爬虫课程讲义 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>urllib2：URLError与HTTPError | Python爬虫课程讲义</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="BigCat">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-tbfed-pagefooter/footer.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../file/part01/1.8.html" />
    
    
    <link rel="prev" href="../../file/part01/1.6.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="1.7"
        data-chapter-title="urllib2：URLError与HTTPError"
        data-filepath="file/part01/1.7.md"
        data-basepath="../.."
        data-revision="Thu Feb 09 2017 09:48:59 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        传智播客Python学院爬虫课程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="file/part01/1.html">
            
                
                    <a href="../../file/part01/1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        爬虫原理与数据抓取
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="file/part01/1.1.html">
            
                
                    <a href="../../file/part01/1.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        (了解)通用爬虫和聚焦爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="file/part01/1.2.html">
            
                
                    <a href="../../file/part01/1.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        (复习)HTTP/HTTPS的请求与响应
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="file/part01/1.3.html">
            
                
                    <a href="../../file/part01/1.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        HTTP/HTTPS抓包工具-Fiddler
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="file/part01/1.4.html">
            
                
                    <a href="../../file/part01/1.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        urllib2模块的基本使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="file/part01/1.5.html">
            
                
                    <a href="../../file/part01/1.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        urllib2：GET请求和POST请求
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="file/part01/1.6.html">
            
                
                    <a href="../../file/part01/1.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        urllib2：Handler处理器和自定义Opener
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1.7" data-path="file/part01/1.7.html">
            
                
                    <a href="../../file/part01/1.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        urllib2：URLError与HTTPError
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="file/part01/1.8.html">
            
                
                    <a href="../../file/part01/1.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        Requests模块
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="file/part02/2.html">
            
                
                    <a href="../../file/part02/2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        非结构化数据与结构化数据提取
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="file/part02/2.1.html">
            
                
                    <a href="../../file/part02/2.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        正则表达式re模块
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="file/part02/2.2.html">
            
                
                    <a href="../../file/part02/2.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        案例：使用正则表达式的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="file/part02/2.3.html">
            
                
                    <a href="../../file/part02/2.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        XPath与lxml类库
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="file/part02/2.4.html">
            
                
                    <a href="../../file/part02/2.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        案例：使用XPath的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="file/part02/2.5.html">
            
                
                    <a href="../../file/part02/2.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        BeautifulSoup4 解析器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="file/part02/2.6.html">
            
                
                    <a href="../../file/part02/2.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        案例：使用bs4的爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="file/part02/2.7.html">
            
                
                    <a href="../../file/part02/2.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        JSON模块与JsonPath
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="file/part02/2.8.html">
            
                
                    <a href="../../file/part02/2.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        糗事百科案例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="file/part02/2.9.html">
            
                
                    <a href="../../file/part02/2.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        多线程爬虫案例
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="file/part03/3.html">
            
                
                    <a href="../../file/part03/3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        动态HTML处理和机器图像识别
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="file/part03/3.1.html">
            
                
                    <a href="../../file/part03/3.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        动态HTML介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="file/part03/3.2.html">
            
                
                    <a href="../../file/part03/3.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Selenium与PhantomJS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="file/part03/3.3.html">
            
                
                    <a href="../../file/part03/3.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        案例一：网站模拟登录
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="file/part03/3.4.html">
            
                
                    <a href="../../file/part03/3.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        案例二：动态页面模拟点击
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="file/part03/3.5.html">
            
                
                    <a href="../../file/part03/3.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        案例三：执行JavaScript语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="file/part03/3.6.html">
            
                
                    <a href="../../file/part03/3.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        机器视觉与Tesseract介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="file/part03/3.7.html">
            
                
                    <a href="../../file/part03/3.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        处理一些格式规范的文字
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="file/part03/3.8.html">
            
                
                    <a href="../../file/part03/3.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        案例：尝试对验证码进行机器识别处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="file/part03/3.9.html">
            
                
                    <a href="../../file/part03/3.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        机器学习：训练Tesseract
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="file/part04/4.html">
            
                
                    <a href="../../file/part04/4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Scrapy框架
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="file/part04/4.1.html">
            
                
                    <a href="../../file/part04/4.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        配置安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="file/part04/4.2.html">
            
                
                    <a href="../../file/part04/4.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        入门案例
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="file/part04/4.3.html">
            
                
                    <a href="../../file/part04/4.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Scrapy Shell
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="file/part04/4.4.html">
            
                
                    <a href="../../file/part04/4.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        Item Pipeline
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="file/part04/4.5.html">
            
                
                    <a href="../../file/part04/4.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        Spiders
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="file/part04/4.6.html">
            
                
                    <a href="../../file/part04/4.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        CrawlSpiders
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="file/part04/4.7.html">
            
                
                    <a href="../../file/part04/4.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        Request/Response
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="file/part04/4.8.html">
            
                
                    <a href="../../file/part04/4.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        Downloader Middlewares
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="file/part04/4.9.html">
            
                
                    <a href="../../file/part04/4.9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        Settings
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="file/part05/5.html">
            
                
                    <a href="../../file/part05/5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Scrapy实战项目
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="file/part05/5.1.html">
            
                
                    <a href="../../file/part05/5.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        (案例一)手机App抓包爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="file/part05/5.2.html">
            
                
                    <a href="../../file/part05/5.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        (案例二)阳光热线问政平台爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="file/part05/5.3.html">
            
                
                    <a href="../../file/part05/5.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        (案例三)新浪网分类资讯爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="file/part05/5.4.html">
            
                
                    <a href="../../file/part05/5.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        (案例四)图片下载器爬虫
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="file/part05/5.5.html">
            
                
                    <a href="../../file/part05/5.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        (案例五)将数据保存在MongoDB中
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="file/part05/5.6.html">
            
                
                    <a href="../../file/part05/5.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        (案例六)三种scrapy模拟登陆策略
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="file/part05/5.7.html">
            
                
                    <a href="../../file/part05/5.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        附：通过Fiddler进行手机抓包方法
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="file/part06/6.html">
            
                
                    <a href="../../file/part06/6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        scrapy-redis分布式组件
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="file/part06/6.1.html">
            
                
                    <a href="../../file/part06/6.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        源码分析参考：Connection
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="file/part06/6.2.html">
            
                
                    <a href="../../file/part06/6.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        源码分析参考：Dupefilter
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="file/part06/6.3.html">
            
                
                    <a href="../../file/part06/6.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        源码分析参考：Picklecompat
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="file/part06/6.4.html">
            
                
                    <a href="../../file/part06/6.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        源码分析参考：Pipelines
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="file/part06/6.5.html">
            
                
                    <a href="../../file/part06/6.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.5.</b>
                        
                        源码分析参考：Queue
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.6" data-path="file/part06/6.6.html">
            
                
                    <a href="../../file/part06/6.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.6.</b>
                        
                        源码分析参考：Scheduler
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.7" data-path="file/part06/6.7.html">
            
                
                    <a href="../../file/part06/6.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.7.</b>
                        
                        源码分析参考：Spider
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="file/part07/7.html">
            
                
                    <a href="../../file/part07/7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        scrapy-redis实战
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="file/part07/7.1.html">
            
                
                    <a href="../../file/part07/7.1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        源码自带项目说明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="file/part07/7.2.html">
            
                
                    <a href="../../file/part07/7.2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        有缘网分布式爬虫项目1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="file/part07/7.3.html">
            
                
                    <a href="../../file/part07/7.3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        有缘网分布式爬虫项目2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="file/part07/7.4.html">
            
                
                    <a href="../../file/part07/7.4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        处理Redis里的数据
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="file/part07/7.5.html">
            
                
                    <a href="../../file/part07/7.5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        尝试改写新浪网分类资讯爬虫1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.6" data-path="file/part07/7.6.html">
            
                
                    <a href="../../file/part07/7.6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        尝试改写新浪网分类资讯爬虫2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.7" data-path="file/part07/7.7.html">
            
                
                    <a href="../../file/part07/7.7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.7.</b>
                        
                        IT桔子分布式项目1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.8" data-path="file/part07/7.8.html">
            
                
                    <a href="../../file/part07/7.8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.8.</b>
                        
                        IT桔子分布式项目2
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="file/duanzi/duanzi.html">
            
                
                    <a href="../../file/duanzi/duanzi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        课余段子
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >Python爬虫课程讲义</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="urllib2-&#x7684;&#x5F02;&#x5E38;&#x9519;&#x8BEF;&#x5904;&#x7406;">urllib2 &#x7684;&#x5F02;&#x5E38;&#x9519;&#x8BEF;&#x5904;&#x7406;</h1>
<p>&#x5728;&#x6211;&#x4EEC;&#x7528;<code>urlopen&#x6216;opener.open</code>&#x65B9;&#x6CD5;&#x53D1;&#x51FA;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x65F6;&#xFF0C;&#x5982;&#x679C;<code>urlopen&#x6216;opener.open</code>&#x4E0D;&#x80FD;&#x5904;&#x7406;&#x8FD9;&#x4E2A;response&#xFF0C;&#x5C31;&#x4EA7;&#x751F;&#x9519;&#x8BEF;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x4E3B;&#x8981;&#x8BF4;&#x7684;&#x662F;URLError&#x548C;HTTPError&#xFF0C;&#x4EE5;&#x53CA;&#x5BF9;&#x5B83;&#x4EEC;&#x7684;&#x9519;&#x8BEF;&#x5904;&#x7406;&#x3002;</p>
<h2 id="urlerror">URLError</h2>
<p>URLError &#x4EA7;&#x751F;&#x7684;&#x539F;&#x56E0;&#x4E3B;&#x8981;&#x6709;&#xFF1A;</p>
<blockquote>
<ol>
<li>&#x6CA1;&#x6709;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;</li>
<li>&#x670D;&#x52A1;&#x5668;&#x8FDE;&#x63A5;&#x5931;&#x8D25;</li>
<li>&#x627E;&#x4E0D;&#x5230;&#x6307;&#x5B9A;&#x7684;&#x670D;&#x52A1;&#x5668;</li>
</ol>
</blockquote>
<p>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;<code>try except</code>&#x8BED;&#x53E5;&#x6765;&#x6355;&#x83B7;&#x76F8;&#x5E94;&#x7684;&#x5F02;&#x5E38;&#x3002;&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#x91CC;&#x6211;&#x4EEC;&#x8BBF;&#x95EE;&#x4E86;&#x4E00;&#x4E2A;&#x4E0D;&#x5B58;&#x5728;&#x7684;&#x57DF;&#x540D;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># urllib2_urlerror.py</span>

<span class="hljs-keyword">import</span> urllib2

requset = urllib2.Request(<span class="hljs-string">&apos;http://www.ajkfhafwjqh.com&apos;</span>)

<span class="hljs-keyword">try</span>:
    urllib2.urlopen(request, timeout=<span class="hljs-number">5</span>)
<span class="hljs-keyword">except</span> urllib2.URLError, err:
    <span class="hljs-keyword">print</span> err
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python">&lt;urlopen error [Errno <span class="hljs-number">8</span>] nodename nor servname provided, <span class="hljs-keyword">or</span> <span class="hljs-keyword">not</span> known&gt;
</code></pre>
<blockquote>
<p>urlopen error&#xFF0C;&#x9519;&#x8BEF;&#x4EE3;&#x7801;8&#xFF0C;&#x9519;&#x8BEF;&#x539F;&#x56E0;&#x662F;&#x6CA1;&#x6709;&#x627E;&#x5230;&#x6307;&#x5B9A;&#x7684;&#x670D;&#x52A1;&#x5668;&#x3002;</p>
</blockquote>
<h2 id="httperror">HTTPError</h2>
<p>HTTPError&#x662F;URLError&#x7684;&#x5B50;&#x7C7B;&#xFF0C;&#x6211;&#x4EEC;&#x53D1;&#x51FA;&#x4E00;&#x4E2A;&#x8BF7;&#x6C42;&#x65F6;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#x90FD;&#x4F1A;&#x5BF9;&#x5E94;&#x4E00;&#x4E2A;response&#x5E94;&#x7B54;&#x5BF9;&#x8C61;&#xFF0C;&#x5176;&#x4E2D;&#x5B83;&#x5305;&#x542B;&#x4E00;&#x4E2A;&#x6570;&#x5B57;&quot;&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&quot;&#x3002;</p>
<p>&#x5982;&#x679C;<code>urlopen&#x6216;opener.open</code>&#x4E0D;&#x80FD;&#x5904;&#x7406;&#x7684;&#xFF0C;&#x4F1A;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;HTTPError&#xFF0C;&#x5BF9;&#x5E94;&#x76F8;&#x5E94;&#x7684;&#x72B6;&#x6001;&#x7801;&#xFF0C;HTTP&#x72B6;&#x6001;&#x7801;&#x8868;&#x793A;HTTP&#x534F;&#x8BAE;&#x6240;&#x8FD4;&#x56DE;&#x7684;&#x54CD;&#x5E94;&#x7684;&#x72B6;&#x6001;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;&#xFF0C;urllib2&#x53EF;&#x4EE5;&#x4E3A;&#x6211;&#x4EEC;&#x5904;&#x7406;&#x91CD;&#x5B9A;&#x5411;&#x7684;&#x9875;&#x9762;&#xFF08;&#x4E5F;&#x5C31;&#x662F;3&#x5F00;&#x5934;&#x7684;&#x54CD;&#x5E94;&#x7801;&#xFF09;&#xFF0C;100-299&#x8303;&#x56F4;&#x7684;&#x53F7;&#x7801;&#x8868;&#x793A;&#x6210;&#x529F;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x53EA;&#x80FD;&#x770B;&#x5230;400-599&#x7684;&#x9519;&#x8BEF;&#x53F7;&#x7801;&#x3002;</strong></p>
<pre><code class="lang-python"><span class="hljs-comment"># urllib2_httperror.py</span>

<span class="hljs-keyword">import</span> urllib2

requset = urllib2.Request(<span class="hljs-string">&apos;http://blog.baidu.com/itcast&apos;</span>)

<span class="hljs-keyword">try</span>:
    urllib2.urlopen(requset)
<span class="hljs-keyword">except</span> urllib2.HTTPError, err:
    <span class="hljs-keyword">print</span> err.code
    <span class="hljs-keyword">print</span> err
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-number">404</span>
HTTP Error <span class="hljs-number">404</span>: Not Found
</code></pre>
<blockquote>
<p>HTTP Error&#xFF0C;&#x9519;&#x8BEF;&#x4EE3;&#x53F7;&#x662F;404&#xFF0C;&#x9519;&#x8BEF;&#x539F;&#x56E0;&#x662F;Not Found&#xFF0C;&#x8BF4;&#x660E;&#x670D;&#x52A1;&#x5668;&#x65E0;&#x6CD5;&#x627E;&#x5230;&#x88AB;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x3002;</p>
<p>&#x901A;&#x5E38;&#x4EA7;&#x751F;&#x8FD9;&#x79CD;&#x9519;&#x8BEF;&#x7684;&#xFF0C;&#x8981;&#x4E48;url&#x4E0D;&#x5BF9;&#xFF0C;&#x8981;&#x4E48;ip&#x88AB;&#x5C01;&#x3002;</p>
</blockquote>
<h2 id="&#x6539;&#x8FDB;&#x7248;">&#x6539;&#x8FDB;&#x7248;</h2>
<p>&#x7531;&#x4E8E;HTTPError&#x7684;&#x7236;&#x7C7B;&#x662F;URLError&#xFF0C;&#x6240;&#x4EE5;&#x7236;&#x7C7B;&#x7684;&#x5F02;&#x5E38;&#x5E94;&#x5F53;&#x5199;&#x5230;&#x5B50;&#x7C7B;&#x5F02;&#x5E38;&#x7684;&#x540E;&#x9762;&#xFF0C;&#x6240;&#x4EE5;&#x4E0A;&#x8FF0;&#x7684;&#x4EE3;&#x7801;&#x53EF;&#x4EE5;&#x8FD9;&#x4E48;&#x6539;&#x5199;&#xFF1A;</p>
<pre><code class="lang-python"><span class="hljs-comment"># urllib2_botherror.py</span>

<span class="hljs-keyword">import</span> urllib2

requset = urllib2.Request(<span class="hljs-string">&apos;http://blog.baidu.com/itcast&apos;</span>)

<span class="hljs-keyword">try</span>:
    urllib2.urlopen(requset)

<span class="hljs-keyword">except</span> urllib2.HTTPError, err:
    <span class="hljs-keyword">print</span> err.code

<span class="hljs-keyword">except</span> urllib2.URLError, err:
    <span class="hljs-keyword">print</span> err

<span class="hljs-keyword">else</span>:
    <span class="hljs-keyword">print</span> <span class="hljs-string">&quot;Good Job&quot;</span>
</code></pre>
<p>&#x8FD0;&#x884C;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-Python"><span class="hljs-number">404</span>
</code></pre>
<h5 id="&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x505A;&#x5230;&#xFF0C;&#x9996;&#x5148;&#x6355;&#x83B7;&#x5B50;&#x7C7B;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5982;&#x679C;&#x5B50;&#x7C7B;&#x6355;&#x83B7;&#x4E0D;&#x5230;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x6355;&#x83B7;&#x7236;&#x7C7B;&#x7684;&#x5F02;&#x5E38;&#x3002;">&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5C31;&#x53EF;&#x4EE5;&#x505A;&#x5230;&#xFF0C;&#x9996;&#x5148;&#x6355;&#x83B7;&#x5B50;&#x7C7B;&#x7684;&#x5F02;&#x5E38;&#xFF0C;&#x5982;&#x679C;&#x5B50;&#x7C7B;&#x6355;&#x83B7;&#x4E0D;&#x5230;&#xFF0C;&#x90A3;&#x4E48;&#x53EF;&#x4EE5;&#x6355;&#x83B7;&#x7236;&#x7C7B;&#x7684;&#x5F02;&#x5E38;&#x3002;</h5>
<h1 id="http&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&#x53C2;&#x8003;&#xFF1A;">HTTP&#x54CD;&#x5E94;&#x72B6;&#x6001;&#x7801;&#x53C2;&#x8003;&#xFF1A;</h1>
<pre><code class="lang-python"><span class="hljs-number">1</span>xx:&#x4FE1;&#x606F;

<span class="hljs-number">100</span> Continue
&#x670D;&#x52A1;&#x5668;&#x4EC5;&#x63A5;&#x6536;&#x5230;&#x90E8;&#x5206;&#x8BF7;&#x6C42;&#xFF0C;&#x4F46;&#x662F;&#x4E00;&#x65E6;&#x670D;&#x52A1;&#x5668;&#x5E76;&#x6CA1;&#x6709;&#x62D2;&#x7EDD;&#x8BE5;&#x8BF7;&#x6C42;&#xFF0C;&#x5BA2;&#x6237;&#x7AEF;&#x5E94;&#x8BE5;&#x7EE7;&#x7EED;&#x53D1;&#x9001;&#x5176;&#x4F59;&#x7684;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">101</span> Switching Protocols
&#x670D;&#x52A1;&#x5668;&#x8F6C;&#x6362;&#x534F;&#x8BAE;&#xFF1A;&#x670D;&#x52A1;&#x5668;&#x5C06;&#x9075;&#x4ECE;&#x5BA2;&#x6237;&#x7684;&#x8BF7;&#x6C42;&#x8F6C;&#x6362;&#x5230;&#x53E6;&#x5916;&#x4E00;&#x79CD;&#x534F;&#x8BAE;&#x3002;



<span class="hljs-number">2</span>xx:&#x6210;&#x529F;

<span class="hljs-number">200</span> OK
&#x8BF7;&#x6C42;&#x6210;&#x529F;&#xFF08;&#x5176;&#x540E;&#x662F;&#x5BF9;GET&#x548C;POST&#x8BF7;&#x6C42;&#x7684;&#x5E94;&#x7B54;&#x6587;&#x6863;&#xFF09;
<span class="hljs-number">201</span> Created
&#x8BF7;&#x6C42;&#x88AB;&#x521B;&#x5EFA;&#x5B8C;&#x6210;&#xFF0C;&#x540C;&#x65F6;&#x65B0;&#x7684;&#x8D44;&#x6E90;&#x88AB;&#x521B;&#x5EFA;&#x3002;
<span class="hljs-number">202</span> Accepted
&#x4F9B;&#x5904;&#x7406;&#x7684;&#x8BF7;&#x6C42;&#x5DF2;&#x88AB;&#x63A5;&#x53D7;&#xFF0C;&#x4F46;&#x662F;&#x5904;&#x7406;&#x672A;&#x5B8C;&#x6210;&#x3002;
<span class="hljs-number">203</span> Non-authoritative Information
&#x6587;&#x6863;&#x5DF2;&#x7ECF;&#x6B63;&#x5E38;&#x5730;&#x8FD4;&#x56DE;&#xFF0C;&#x4F46;&#x4E00;&#x4E9B;&#x5E94;&#x7B54;&#x5934;&#x53EF;&#x80FD;&#x4E0D;&#x6B63;&#x786E;&#xFF0C;&#x56E0;&#x4E3A;&#x4F7F;&#x7528;&#x7684;&#x662F;&#x6587;&#x6863;&#x7684;&#x62F7;&#x8D1D;&#x3002;
<span class="hljs-number">204</span> No Content
&#x6CA1;&#x6709;&#x65B0;&#x6587;&#x6863;&#x3002;&#x6D4F;&#x89C8;&#x5668;&#x5E94;&#x8BE5;&#x7EE7;&#x7EED;&#x663E;&#x793A;&#x539F;&#x6765;&#x7684;&#x6587;&#x6863;&#x3002;&#x5982;&#x679C;&#x7528;&#x6237;&#x5B9A;&#x671F;&#x5730;&#x5237;&#x65B0;&#x9875;&#x9762;&#xFF0C;&#x800C;Servlet&#x53EF;&#x4EE5;&#x786E;&#x5B9A;&#x7528;&#x6237;&#x6587;&#x6863;&#x8DB3;&#x591F;&#x65B0;&#xFF0C;&#x8FD9;&#x4E2A;&#x72B6;&#x6001;&#x4EE3;&#x7801;&#x662F;&#x5F88;&#x6709;&#x7528;&#x7684;&#x3002;
<span class="hljs-number">205</span> Reset Content
&#x6CA1;&#x6709;&#x65B0;&#x6587;&#x6863;&#x3002;&#x4F46;&#x6D4F;&#x89C8;&#x5668;&#x5E94;&#x8BE5;&#x91CD;&#x7F6E;&#x5B83;&#x6240;&#x663E;&#x793A;&#x7684;&#x5185;&#x5BB9;&#x3002;&#x7528;&#x6765;&#x5F3A;&#x5236;&#x6D4F;&#x89C8;&#x5668;&#x6E05;&#x9664;&#x8868;&#x5355;&#x8F93;&#x5165;&#x5185;&#x5BB9;&#x3002;
<span class="hljs-number">206</span> Partial Content
&#x5BA2;&#x6237;&#x53D1;&#x9001;&#x4E86;&#x4E00;&#x4E2A;&#x5E26;&#x6709;Range&#x5934;&#x7684;GET&#x8BF7;&#x6C42;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x5B8C;&#x6210;&#x4E86;&#x5B83;&#x3002;



<span class="hljs-number">3</span>xx:&#x91CD;&#x5B9A;&#x5411;

<span class="hljs-number">300</span> Multiple Choices
&#x591A;&#x91CD;&#x9009;&#x62E9;&#x3002;&#x94FE;&#x63A5;&#x5217;&#x8868;&#x3002;&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x9009;&#x62E9;&#x67D0;&#x94FE;&#x63A5;&#x5230;&#x8FBE;&#x76EE;&#x7684;&#x5730;&#x3002;&#x6700;&#x591A;&#x5141;&#x8BB8;&#x4E94;&#x4E2A;&#x5730;&#x5740;&#x3002;
<span class="hljs-number">301</span> Moved Permanently
&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x5DF2;&#x7ECF;&#x8F6C;&#x79FB;&#x81F3;&#x65B0;&#x7684;url&#x3002;
<span class="hljs-number">302</span> Moved Temporarily
&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x5DF2;&#x7ECF;&#x4E34;&#x65F6;&#x8F6C;&#x79FB;&#x81F3;&#x65B0;&#x7684;url&#x3002;
<span class="hljs-number">303</span> See Other
&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x53EF;&#x5728;&#x522B;&#x7684;url&#x4E0B;&#x88AB;&#x627E;&#x5230;&#x3002;
<span class="hljs-number">304</span> Not Modified
&#x672A;&#x6309;&#x9884;&#x671F;&#x4FEE;&#x6539;&#x6587;&#x6863;&#x3002;&#x5BA2;&#x6237;&#x7AEF;&#x6709;&#x7F13;&#x51B2;&#x7684;&#x6587;&#x6863;&#x5E76;&#x53D1;&#x51FA;&#x4E86;&#x4E00;&#x4E2A;&#x6761;&#x4EF6;&#x6027;&#x7684;&#x8BF7;&#x6C42;&#xFF08;&#x4E00;&#x822C;&#x662F;&#x63D0;&#x4F9B;If-Modified-Since&#x5934;&#x8868;&#x793A;&#x5BA2;&#x6237;&#x53EA;&#x60F3;&#x6BD4;&#x6307;&#x5B9A;&#x65E5;&#x671F;&#x66F4;&#x65B0;&#x7684;&#x6587;&#x6863;&#xFF09;&#x3002;&#x670D;&#x52A1;&#x5668;&#x544A;&#x8BC9;&#x5BA2;&#x6237;&#xFF0C;&#x539F;&#x6765;&#x7F13;&#x51B2;&#x7684;&#x6587;&#x6863;&#x8FD8;&#x53EF;&#x4EE5;&#x7EE7;&#x7EED;&#x4F7F;&#x7528;&#x3002;
<span class="hljs-number">305</span> Use Proxy
&#x5BA2;&#x6237;&#x8BF7;&#x6C42;&#x7684;&#x6587;&#x6863;&#x5E94;&#x8BE5;&#x901A;&#x8FC7;Location&#x5934;&#x6240;&#x6307;&#x660E;&#x7684;&#x4EE3;&#x7406;&#x670D;&#x52A1;&#x5668;&#x63D0;&#x53D6;&#x3002;
<span class="hljs-number">306</span> Unused
&#x6B64;&#x4EE3;&#x7801;&#x88AB;&#x7528;&#x4E8E;&#x524D;&#x4E00;&#x7248;&#x672C;&#x3002;&#x76EE;&#x524D;&#x5DF2;&#x4E0D;&#x518D;&#x4F7F;&#x7528;&#xFF0C;&#x4F46;&#x662F;&#x4EE3;&#x7801;&#x4F9D;&#x7136;&#x88AB;&#x4FDD;&#x7559;&#x3002;
<span class="hljs-number">307</span> Temporary Redirect
&#x88AB;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x5DF2;&#x7ECF;&#x4E34;&#x65F6;&#x79FB;&#x81F3;&#x65B0;&#x7684;url&#x3002;



<span class="hljs-number">4</span>xx:&#x5BA2;&#x6237;&#x7AEF;&#x9519;&#x8BEF;

<span class="hljs-number">400</span> Bad Request
&#x670D;&#x52A1;&#x5668;&#x672A;&#x80FD;&#x7406;&#x89E3;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">401</span> Unauthorized
&#x88AB;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x9700;&#x8981;&#x7528;&#x6237;&#x540D;&#x548C;&#x5BC6;&#x7801;&#x3002;
<span class="hljs-number">401.1</span>
&#x767B;&#x5F55;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">401.2</span>
&#x670D;&#x52A1;&#x5668;&#x914D;&#x7F6E;&#x5BFC;&#x81F4;&#x767B;&#x5F55;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">401.3</span>
&#x7531;&#x4E8E; ACL &#x5BF9;&#x8D44;&#x6E90;&#x7684;&#x9650;&#x5236;&#x800C;&#x672A;&#x83B7;&#x5F97;&#x6388;&#x6743;&#x3002;
<span class="hljs-number">401.4</span>
&#x7B5B;&#x9009;&#x5668;&#x6388;&#x6743;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">401.5</span>
ISAPI/CGI &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6388;&#x6743;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">401.7</span>
&#x8BBF;&#x95EE;&#x88AB; Web &#x670D;&#x52A1;&#x5668;&#x4E0A;&#x7684; URL &#x6388;&#x6743;&#x7B56;&#x7565;&#x62D2;&#x7EDD;&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">402</span> Payment Required
&#x6B64;&#x4EE3;&#x7801;&#x5C1A;&#x65E0;&#x6CD5;&#x4F7F;&#x7528;&#x3002;
<span class="hljs-number">403</span> Forbidden
&#x5BF9;&#x88AB;&#x8BF7;&#x6C42;&#x9875;&#x9762;&#x7684;&#x8BBF;&#x95EE;&#x88AB;&#x7981;&#x6B62;&#x3002;
<span class="hljs-number">403.1</span>
&#x6267;&#x884C;&#x8BBF;&#x95EE;&#x88AB;&#x7981;&#x6B62;&#x3002;
<span class="hljs-number">403.2</span>
&#x8BFB;&#x8BBF;&#x95EE;&#x88AB;&#x7981;&#x6B62;&#x3002;
<span class="hljs-number">403.3</span>
&#x5199;&#x8BBF;&#x95EE;&#x88AB;&#x7981;&#x6B62;&#x3002;
<span class="hljs-number">403.4</span>
&#x8981;&#x6C42; SSL&#x3002;
<span class="hljs-number">403.5</span>
&#x8981;&#x6C42; SSL <span class="hljs-number">128</span>&#x3002;
<span class="hljs-number">403.6</span>
IP &#x5730;&#x5740;&#x88AB;&#x62D2;&#x7EDD;&#x3002;
<span class="hljs-number">403.7</span>
&#x8981;&#x6C42;&#x5BA2;&#x6237;&#x7AEF;&#x8BC1;&#x4E66;&#x3002;
<span class="hljs-number">403.8</span>
&#x7AD9;&#x70B9;&#x8BBF;&#x95EE;&#x88AB;&#x62D2;&#x7EDD;&#x3002;
<span class="hljs-number">403.9</span>
&#x7528;&#x6237;&#x6570;&#x8FC7;&#x591A;&#x3002;
<span class="hljs-number">403.10</span>
&#x914D;&#x7F6E;&#x65E0;&#x6548;&#x3002;
<span class="hljs-number">403.11</span>
&#x5BC6;&#x7801;&#x66F4;&#x6539;&#x3002;
<span class="hljs-number">403.12</span>
&#x62D2;&#x7EDD;&#x8BBF;&#x95EE;&#x6620;&#x5C04;&#x8868;&#x3002;
<span class="hljs-number">403.13</span>
&#x5BA2;&#x6237;&#x7AEF;&#x8BC1;&#x4E66;&#x88AB;&#x540A;&#x9500;&#x3002;
<span class="hljs-number">403.14</span>
&#x62D2;&#x7EDD;&#x76EE;&#x5F55;&#x5217;&#x8868;&#x3002;
<span class="hljs-number">403.15</span>
&#x8D85;&#x51FA;&#x5BA2;&#x6237;&#x7AEF;&#x8BBF;&#x95EE;&#x8BB8;&#x53EF;&#x3002;
<span class="hljs-number">403.16</span>
&#x5BA2;&#x6237;&#x7AEF;&#x8BC1;&#x4E66;&#x4E0D;&#x53D7;&#x4FE1;&#x4EFB;&#x6216;&#x65E0;&#x6548;&#x3002;
<span class="hljs-number">403.17</span>
&#x5BA2;&#x6237;&#x7AEF;&#x8BC1;&#x4E66;&#x5DF2;&#x8FC7;&#x671F;&#x6216;&#x5C1A;&#x672A;&#x751F;&#x6548;&#x3002;
<span class="hljs-number">403.18</span>
&#x5728;&#x5F53;&#x524D;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6C60;&#x4E2D;&#x4E0D;&#x80FD;&#x6267;&#x884C;&#x6240;&#x8BF7;&#x6C42;&#x7684; URL&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">403.19</span>
&#x4E0D;&#x80FD;&#x4E3A;&#x8FD9;&#x4E2A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6C60;&#x4E2D;&#x7684;&#x5BA2;&#x6237;&#x7AEF;&#x6267;&#x884C; CGI&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">403.20</span>
Passport &#x767B;&#x5F55;&#x5931;&#x8D25;&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">404</span> Not Found
&#x670D;&#x52A1;&#x5668;&#x65E0;&#x6CD5;&#x627E;&#x5230;&#x88AB;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x3002;
<span class="hljs-number">404.0</span>
&#x6CA1;&#x6709;&#x627E;&#x5230;&#x6587;&#x4EF6;&#x6216;&#x76EE;&#x5F55;&#x3002;
<span class="hljs-number">404.1</span>
&#x65E0;&#x6CD5;&#x5728;&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x7AEF;&#x53E3;&#x4E0A;&#x8BBF;&#x95EE; Web &#x7AD9;&#x70B9;&#x3002;
<span class="hljs-number">404.2</span>
Web &#x670D;&#x52A1;&#x6269;&#x5C55;&#x9501;&#x5B9A;&#x7B56;&#x7565;&#x963B;&#x6B62;&#x672C;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">404.3</span>
MIME &#x6620;&#x5C04;&#x7B56;&#x7565;&#x963B;&#x6B62;&#x672C;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">405</span> Method Not Allowed
&#x8BF7;&#x6C42;&#x4E2D;&#x6307;&#x5B9A;&#x7684;&#x65B9;&#x6CD5;&#x4E0D;&#x88AB;&#x5141;&#x8BB8;&#x3002;
<span class="hljs-number">406</span> Not Acceptable
&#x670D;&#x52A1;&#x5668;&#x751F;&#x6210;&#x7684;&#x54CD;&#x5E94;&#x65E0;&#x6CD5;&#x88AB;&#x5BA2;&#x6237;&#x7AEF;&#x6240;&#x63A5;&#x53D7;&#x3002;
<span class="hljs-number">407</span> Proxy Authentication Required
&#x7528;&#x6237;&#x5FC5;&#x987B;&#x9996;&#x5148;&#x4F7F;&#x7528;&#x4EE3;&#x7406;&#x670D;&#x52A1;&#x5668;&#x8FDB;&#x884C;&#x9A8C;&#x8BC1;&#xFF0C;&#x8FD9;&#x6837;&#x8BF7;&#x6C42;&#x624D;&#x4F1A;&#x88AB;&#x5904;&#x7406;&#x3002;
<span class="hljs-number">408</span> Request Timeout
&#x8BF7;&#x6C42;&#x8D85;&#x51FA;&#x4E86;&#x670D;&#x52A1;&#x5668;&#x7684;&#x7B49;&#x5F85;&#x65F6;&#x95F4;&#x3002;
<span class="hljs-number">409</span> Conflict
&#x7531;&#x4E8E;&#x51B2;&#x7A81;&#xFF0C;&#x8BF7;&#x6C42;&#x65E0;&#x6CD5;&#x88AB;&#x5B8C;&#x6210;&#x3002;
<span class="hljs-number">410</span> Gone
&#x88AB;&#x8BF7;&#x6C42;&#x7684;&#x9875;&#x9762;&#x4E0D;&#x53EF;&#x7528;&#x3002;
<span class="hljs-number">411</span> Length Required
<span class="hljs-string">&quot;Content-Length&quot;</span> &#x672A;&#x88AB;&#x5B9A;&#x4E49;&#x3002;&#x5982;&#x679C;&#x65E0;&#x6B64;&#x5185;&#x5BB9;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x4F1A;&#x63A5;&#x53D7;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">412</span> Precondition Failed
&#x8BF7;&#x6C42;&#x4E2D;&#x7684;&#x524D;&#x63D0;&#x6761;&#x4EF6;&#x88AB;&#x670D;&#x52A1;&#x5668;&#x8BC4;&#x4F30;&#x4E3A;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">413</span> Request Entity Too Large
&#x7531;&#x4E8E;&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x5B9E;&#x4F53;&#x7684;&#x592A;&#x5927;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x4F1A;&#x63A5;&#x53D7;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">414</span> Request-url Too Long
&#x7531;&#x4E8E;url&#x592A;&#x957F;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x4F1A;&#x63A5;&#x53D7;&#x8BF7;&#x6C42;&#x3002;&#x5F53;post&#x8BF7;&#x6C42;&#x88AB;&#x8F6C;&#x6362;&#x4E3A;&#x5E26;&#x6709;&#x5F88;&#x957F;&#x7684;&#x67E5;&#x8BE2;&#x4FE1;&#x606F;&#x7684;get&#x8BF7;&#x6C42;&#x65F6;&#xFF0C;&#x5C31;&#x4F1A;&#x53D1;&#x751F;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x3002;
<span class="hljs-number">415</span> Unsupported Media Type
&#x7531;&#x4E8E;&#x5A92;&#x4ECB;&#x7C7B;&#x578B;&#x4E0D;&#x88AB;&#x652F;&#x6301;&#xFF0C;&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x4F1A;&#x63A5;&#x53D7;&#x8BF7;&#x6C42;&#x3002;
<span class="hljs-number">416</span> Requested Range Not Satisfiable
&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x80FD;&#x6EE1;&#x8DB3;&#x5BA2;&#x6237;&#x5728;&#x8BF7;&#x6C42;&#x4E2D;&#x6307;&#x5B9A;&#x7684;Range&#x5934;&#x3002;
<span class="hljs-number">417</span> Expectation Failed
&#x6267;&#x884C;&#x5931;&#x8D25;&#x3002;
<span class="hljs-number">423</span>
&#x9501;&#x5B9A;&#x7684;&#x9519;&#x8BEF;&#x3002;



<span class="hljs-number">5</span>xx:&#x670D;&#x52A1;&#x5668;&#x9519;&#x8BEF;

<span class="hljs-number">500</span> Internal Server Error
&#x8BF7;&#x6C42;&#x672A;&#x5B8C;&#x6210;&#x3002;&#x670D;&#x52A1;&#x5668;&#x9047;&#x5230;&#x4E0D;&#x53EF;&#x9884;&#x77E5;&#x7684;&#x60C5;&#x51B5;&#x3002;
<span class="hljs-number">500.12</span>
&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x6B63;&#x5FD9;&#x4E8E;&#x5728; Web &#x670D;&#x52A1;&#x5668;&#x4E0A;&#x91CD;&#x65B0;&#x542F;&#x52A8;&#x3002;
<span class="hljs-number">500.13</span>
Web &#x670D;&#x52A1;&#x5668;&#x592A;&#x5FD9;&#x3002;
<span class="hljs-number">500.15</span>
&#x4E0D;&#x5141;&#x8BB8;&#x76F4;&#x63A5;&#x8BF7;&#x6C42; Global.asa&#x3002;
<span class="hljs-number">500.16</span>
UNC &#x6388;&#x6743;&#x51ED;&#x636E;&#x4E0D;&#x6B63;&#x786E;&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">500.18</span>
URL &#x6388;&#x6743;&#x5B58;&#x50A8;&#x4E0D;&#x80FD;&#x6253;&#x5F00;&#x3002;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#x4EE3;&#x7801;&#x4E3A; IIS <span class="hljs-number">6.0</span> &#x6240;&#x4E13;&#x7528;&#x3002;
<span class="hljs-number">500.100</span>
&#x5185;&#x90E8; ASP &#x9519;&#x8BEF;&#x3002;
<span class="hljs-number">501</span> Not Implemented
&#x8BF7;&#x6C42;&#x672A;&#x5B8C;&#x6210;&#x3002;&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x652F;&#x6301;&#x6240;&#x8BF7;&#x6C42;&#x7684;&#x529F;&#x80FD;&#x3002;
<span class="hljs-number">502</span> Bad Gateway
&#x8BF7;&#x6C42;&#x672A;&#x5B8C;&#x6210;&#x3002;&#x670D;&#x52A1;&#x5668;&#x4ECE;&#x4E0A;&#x6E38;&#x670D;&#x52A1;&#x5668;&#x6536;&#x5230;&#x4E00;&#x4E2A;&#x65E0;&#x6548;&#x7684;&#x54CD;&#x5E94;&#x3002;
<span class="hljs-number">502.1</span>
CGI &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x8D85;&#x65F6;&#x3002;&#x3000;&#xB7;
<span class="hljs-number">502.2</span>
CGI &#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x51FA;&#x9519;&#x3002;
<span class="hljs-number">503</span> Service Unavailable
&#x8BF7;&#x6C42;&#x672A;&#x5B8C;&#x6210;&#x3002;&#x670D;&#x52A1;&#x5668;&#x4E34;&#x65F6;&#x8FC7;&#x8F7D;&#x6216;&#x5F53;&#x673A;&#x3002;
<span class="hljs-number">504</span> Gateway Timeout
&#x7F51;&#x5173;&#x8D85;&#x65F6;&#x3002;
<span class="hljs-number">505</span> HTTP Version Not Supported
&#x670D;&#x52A1;&#x5668;&#x4E0D;&#x652F;&#x6301;&#x8BF7;&#x6C42;&#x4E2D;&#x6307;&#x660E;&#x7684;HTTP&#x534F;&#x8BAE;&#x7248;&#x672C;
</code></pre>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; BigCat all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x300C;Revision Time:
2017-01-11 13:36:11&#x300D;
</span></footer>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../file/part01/1.6.html" class="navigation navigation-prev " aria-label="Previous page: urllib2：Handler处理器和自定义Opener"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../file/part01/1.8.html" class="navigation navigation-next " aria-label="Next page: Requests模块"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"disqus":{"shortName":"gitbookuse"},"github":{"url":"https://github.com/dododream"},"search-pro":{"cutWordLib":"nodejieba","defineWord":["gitbook-use"]},"sharing":{"weibo":true,"facebook":true,"twitter":true,"google":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"tbfed-pagefooter":{"copyright":"Copyright © BigCat","modify_label":"「Revision Time:","modify_format":"YYYY-MM-DD HH:mm:ss」"},"baidu":{"token":"ff100361cdce95dd4c8fb96b4009f7bc"},"sitemap":{"hostname":"http://www.treenewbee.top"},"donate":{"wechat":"http://weixin.png","alipay":"http://alipay.png","title":"","button":"赏","alipayText":"支付宝打赏","wechatText":"微信打赏"},"edit-link":{"base":"https://github.com/dododream/edit","label":"Edit This Page"},"splitter":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book Python爬虫课程讲义 -->
</html>
